package po;

import java.io.Serializable;


/**
 * @author LiuHao
 * 
 */
public class UserPO implements Serializable {

	private static final long serialVersionUID = 1L;

	protected int id;

	protected String username;

	protected String password;

	protected UserIdentity identity;

	public UserPO(int id, String username, String password,
			UserIdentity identity) {
		this.id = id;
		this.username = username;
		this.password = password;
		this.identity = identity;
	}
	
	public UserPO() {
		this.id = 0;
		this.username = "";
		this.password = "";
		this.identity = UserIdentity.CUSTOMER;
	}
	
	public UserPO(UserPO userPO) {
		this.id = userPO.id;
		this.username = userPO.username;
		this.password = userPO.password;
		this.identity = userPO.identity;
	}

	@Override
	public String toString() {
		return "UserPO [id=" + id + ", username=" + username + ", password="
				+ password + ", identity=" + identity + "]";
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		UserPO other = (UserPO) obj;
		if (id != other.id)
			return false;
		return true;
	}

	public void setId(int id) {
		this.id = id;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public void setIdentity(UserIdentity identity) {
		this.identity = identity;
	}

	public int getId() {
		return id;
	}

	public String getUsername() {
		return username;
	}

	public String getPassword() {
		return password;
	}

	public UserIdentity getIdentity() {
		return identity;
	}

}
